package com.ssy.lingxi.settle.accounts.controller;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.dto.request.MemberSettlementStrategyRequest;
import com.ssy.lingxi.dto.response.MemberSettlementStrategyResponse;
import com.ssy.lingxi.dto.response.PlatformAccountConfigDetailVO;
import com.ssy.lingxi.settle.accounts.service.IMemberSettlementStrategyService;
import com.ssy.lingxi.settle.accounts.service.IPlatformAccountConfigService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 结算服务平台配置Feign接口
 * @author 伍将
 * @date 2020/11/19
 **/
@RestController
@RequestMapping("/settle/accounts/platform/config/feign")
public class PlatformConfigFeignController {

    @Resource
    private IPlatformAccountConfigService platformAccountConfigService;

    @Resource
    private IMemberSettlementStrategyService strategyService;

    /**
     * 获取平台对公账户配置
     * @author 伍将
     * @date 2020/11/19
     **/
    @RequestMapping(value = "/getPlatformAccountConfig", method = RequestMethod.GET)
    public Wrapper<PlatformAccountConfigDetailVO> getPlatformAccountConfig() {
        return platformAccountConfigService.getDetail();
    }

    /**
     * 获取会员结算策略(账期、月结)
     * @author ds
     * @date 2020/4/13
     **/
    @RequestMapping(value = "/getMemberSettlementStrategy")
    public Wrapper<MemberSettlementStrategyResponse> getMemberSettlementStrategy(@RequestBody @Valid MemberSettlementStrategyRequest memberSettlementStrategyRequest) {
        return strategyService.getMemberSettlementStrategy(memberSettlementStrategyRequest);
    }
}
